const global = getApp().globalData;
const wxApi = global.wxApi;
const util = global.util;
Component({
  properties: {
    memories: {
      type: Array,
      value: []
    }
  },
  methods: {
    onMemoriesMore() {
      let path = '../memories/memories';
      let memories = this.data.memories;
      memories = memories.map((item) => {
        return {
          img: item.img,
          id: item.id,
          title: item.title
        }
      })
      memories = util.encodeURI( memories );
      wxApi.navigateTo(path, {
        memories: memories
      });
    },
    onMemoryDetail( e ) {
      let video = e.currentTarget.dataset.video;
      wxApi.navigateTo('../memory-detail/memory-detail', {
        id: video.id
      })
    }
  }
})